package com.smart.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.smart.entity.Goods;
import com.smart.mapper.GoodsMapper;
import com.smart.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public List<Goods> GoodsAll() {
        List<Goods> goodsList = goodsMapper.selectList(null);
        System.out.println(goodsList);
        return goodsList;
    }

    @Override
    public List<Goods> GoodsShelf() {
        QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("goods_name", "goods_img","goods_details","goods_purchase", "goods_sale", "goods_status");
        queryWrapper.eq("goods_status",1);
        List<Goods> goodsList = goodsMapper.selectList(queryWrapper);
        System.out.println(goodsList);
        return goodsList;
    }

    @Override
    public List<Goods> GoodsRemove () {
        QueryWrapper<Goods> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("goods_name", "goods_img","goods_details","goods_purchase", "goods_sale", "goods_status");
        queryWrapper.eq("goods_status",0);
        List<Goods> goodsList = goodsMapper.selectList(queryWrapper);
        System.out.println(goodsList);
        return goodsList;
    }

    @Override
    public void GoodsAdd(Goods goods) {

    }
}
